package com.shop.shop_end.controller;

import com.shop.shop_end.dto.TopicVo;
import com.shop.shop_end.entity.Good;
import com.shop.shop_end.entity.Order;
import com.shop.shop_end.entity.Topic;
import com.shop.shop_end.entity.User;
import com.shop.shop_end.service.GoodService;
import com.shop.shop_end.service.OrderService;
import com.shop.shop_end.service.TopicService;
import com.shop.shop_end.service.UserService;
import com.shop.shop_end.utils.result.Result;
import com.shop.shop_end.vo.GoodVo;
import com.shop.shop_end.vo.OrderVo;
import com.shop.shop_end.vo.UserVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2024-04-23
 */
@RestController
@RequestMapping("/topic")
public class TopicController extends BaseController{
    Logger logger = LoggerFactory.getLogger(TopicController.class);

    @Autowired
    private TopicService topicService;
    @Autowired
    private UserService userService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private GoodService goodService;

    // 添加数据
    @RequestMapping("addTopic")
    public Result addTopic(@RequestBody Topic topic) {
        return this.topicService.insertTopic(topic);
    }

    // 通过主键删除数据
    @RequestMapping("deleteTopicById/{id}")
    public Result deleteTopicById(@PathVariable("id") Long id) {
        return this.topicService.deleteTopicById(id);
    }

    // 更新数据
    @RequestMapping("updateTopic")
    public Result updateTopic(@RequestBody Topic topic) {
        return this.topicService.updateTopic(topic);
    }


}
